//
//  YSVipValidateCtrl.m
//  Yueshi
//
//  Created by Northwan on 16/4/14.
//  Copyright © 2016年 悦食中国. All rights reserved.
//

#import "YSVipValidateCtrl.h"
#import "YSVipValidateView.h"
#import "YSCategoryDataTool.h"
@interface YSVipValidateCtrl ()<YSPwdViewDelegate>

@end

@implementation YSVipValidateCtrl

- (void)viewDidLoad {
    [super viewDidLoad];
    
    YSVipValidateView *validateView =[YSVipValidateView new];
    validateView.pwdView.delegate = self;
    [self.view addSubview:validateView];
}

-(void)inputFinish:(NSString *)pwdText{
    [YSCategoryDataTool validVipCode:pwdText success:^(BaseResponse *result) {
        if (result.isSucc){
            self.callback();
        }else{
            ShowTips(result.data)
        }
        [self dismissViewControllerAnimated:NO completion:nil];
    } failure:^(NSError *error) {
        ShowTips(kRequestFailure)
        [self dismissViewControllerAnimated:NO completion:nil];
    }];
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self dismissViewControllerAnimated:NO completion:nil];
}

@end
